home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / pennmush.000 / pennmush-1.50-p8-linux.tar / pennmush / game / restart < prev    next >
Text File  |  1993-10-22  |  2KB  |  93 lines

  1. #!/bin/sh
  2. #
  3.  
  4. # usage: restart
  5.  
  6. #-- options
  7.  
  8. # You will almost definitely want to change this. In general, it
  9. #  should be the directory this script is in. Provide a full pathname.
  10. #  This is usually something like /home/lwl/pennmush/game
  11. GAMEDIR=/usr/src/pennmush/game
  12.  
  13. # The config file
  14. CONF_FILE=mush.conf
  15.  
  16. # This is where the general error messages are placed.
  17. LOG=log/netmush.log
  18.  
  19. #-- database files
  20.  
  21. # These names must match those in the conf file.
  22.  
  23. # You probably want to change this. Usually for a running MUSH, it's indb.Z 
  24. # Already did it. - Liem
  25. INDB=indb.Z
  26.  
  27. # This is where the database is dumped to when the game is active.
  28. OUTDB=outdb.Z
  29.  
  30. # This is the directory and file where panic (crash) databases are placed.
  31. PANICDIR=data
  32. PANICDB=PANIC.db
  33.  
  34. #-- start up everything
  35.  
  36. # Prevent double-starting things. You may need to provide a pathname for
  37. #  some of the commands.
  38. mush=`ps ux | egrep conf | wc -l`
  39.  
  40. # Uncomment the following only if you are RUNNING an RWHO server and want to 
  41. #  restart it as well
  42. #mwhod=`ps ux | egrep mwhod | wc -l`
  43.  
  44. cd $GAMEDIR
  45.  
  46. # Uncomment the following only to restart the RWHO server
  47. #if [ $mwhod -eq 1]; then
  48. #  echo restarting mud who daemon
  49. #  ./mwhod -f muds.dat -n FooWHO >mwhod.log 2>&1 &
  50. #fi
  51.  
  52. if [ $mush -gt 1 ]; then
  53.   echo Mush already active.
  54.   exit 0
  55. fi
  56.  
  57. echo Building text file indexes.
  58. ./mkindx txt/help.txt txt/help.indx
  59. ./mkindx txt/news.txt txt/news.indx
  60. ./mkindx txt/events.txt txt/events.indx
  61.  
  62. echo Restarting Mush.
  63.  
  64. if [ -r $PANICDIR/$PANICDB ]; then
  65.    end="`tail -1 $PANICDIR/$PANICDB`"
  66.    if [ "$end" = "***END OF DUMP***" ]; then
  67.       mv $PANICDIR/$PANICDB $PANICDIR/temp
  68.       compress $PANICDIR/temp
  69.       mv $PANICDIR/temp.Z data/$OUTDB
  70.       echo "PANIC dump successfully recovered."
  71.    else
  72.       rm $PANICDIR/$PANICDB
  73.       echo "Warning: PANIC dump corrupt. Using older db."
  74.    fi
  75. fi
  76.  
  77. rm -f save/$INDB.old
  78. mv -f data/$INDB save/$INDB.old
  79. rm -f log/*
  80.  
  81. if [ -r data/$OUTDB ]; then
  82.    mv data/$OUTDB data/$INDB
  83. else
  84.    echo "No recent database found. Using older database."
  85.    cp save/$INDB.old data/$INDB
  86. fi
  87.  
  88. (nohup ./netmush $CONF_FILE >$LOG 2>&1 &)
  89.  
  90.  
  91.  
  92.  
  93.